<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 *
 *
 *
 * @package     h
 * @subpackage  models
 * @category    models
 * @author      hyw
 * @copyright   copyright (c) 2012
 * @filesource
 */
class del_model extends CI_model {
    
    public function __construct() {
        parent::__construct();
    }
    

    function del_object() {
        $sql = "TRUNCATE TABLE h_object";
        $this->db->query($sql);
    }
    
    function del_client() {
        $sql = "TRUNCATE TABLE h_client";
        $this->db->query($sql);
    }
    
    function del_demand() {
        $sql = "TRUNCATE TABLE h_demand";
        $this->db->query($sql);
    }
    
    function del_users() {
        $sql = "TRUNCATE TABLE h_users";
        $this->db->query($sql);
    }
    
    function del_sms() {
        $sql = "TRUNCATE TABLE h_sms";
        $this->db->query($sql);
    }
    
    function del_edm() {
        $sql = "TRUNCATE TABLE h_edm";
        $this->db->query($sql);
    }
    
    function del_department() {
        $sql = "TRUNCATE TABLE h_department";
        $this->db->query($sql);
    }
    
    function del_role() {
        $sql = "TRUNCATE TABLE h_role";
        $this->db->query($sql);
        
    }
    
    function insert(){
        
        $sql="INSERT INTO `h_users` ( `user`, `password`, `shop_point_id`, `department_id`, `role_id`, `name`, `email`, `phone`, `protocol`, `mailpath`, `smtp_host`, `smtp_user`, `smtp_pass`, `smtp_port`, `users_ctime`, `users_mtime`, `users_dtime`) VALUES ".
             " ( 'admin', '18e47d94ce6b20a6cfb07331fa441f48', 1, 1, 1, '超級管理員', '13631275628@163.com', '', '', '', '', '', '', '', 1378046739, 0, 0);";
        $this->db->query($sql);
        
        $sql =  " INSERT INTO `h_role` ( `department_id`, `role_name`, `description`, `purview`, `sequence`, `role_ctime`, `role_mtime`, `role_dtime`) VALUES ".
                " ( 1, '超級管理员', '超級管理员', '#all', 0, 1377603583, 1378998161, 0); ";
        $this->db->query($sql);
    }
    
    
    function sys_del() {
        
        
        $this->del_client();
        $this->del_sms();
        $this->del_demand();
        $this->del_department();
        $this->del_edm();
        $this->del_object();
        $this->del_role();
        $this->del_users();
        $this->insert();
        
                
    }
    

}
